<!DOCTYPE html>
<html>
<head>
    <title>新闻表</title>
    <#include "/header.html">
    <script src="${request.contextPath}/statics/libs/ajaxupload.js"></script>
    <!-- 配置文件 -->
    <script type="text/javascript" src="${request.contextPath}/statics/libs/ueditor1.4.3/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="${request.contextPath}/statics/libs/ueditor1.4.3/ueditor.all.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="${request.contextPath}/statics/libs/ueditor1.4.3/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
			<#if shiro.hasPermission("news:news:save")>
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
			</#if>
			<#if shiro.hasPermission("news:news:update")>
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
			</#if>
			<#if shiro.hasPermission("news:news:delete")>
            <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
			</#if>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
                    <div class="form-group">
                        <div class="col-sm-2 control-label">标题</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="news.title" placeholder="标题"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">封面图</div>
                        <div class="col-sm-10">
                            <button class="btn btn-primary" id="upload"><i class="fa fa-plus"></i>&nbsp;上传图片</button>
                            <img :src="news.coverimage" id="coverimg" style="width:40px;height:40px;" />
                            <input type="hidden" id="coverimage" class="form-control" v-model="news.coverimage" placeholder="封面图"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">新闻类型</div>
                        <div class="col-sm-10">
                            <select name="newstype" class="form-control" v-model="news.newstype">
                                <option value="Innovation">创新</option>
                                <option value="News">新闻动态</option>
                                <option value="Story">故事</option>
                            </select>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">来源</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="news.source" placeholder="来源"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">seo标题</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="news.seotitle" placeholder="seo标题"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">seo关键字</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="news.seokeyword" placeholder="seo关键字"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">seo描述</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="news.seodescription" placeholder="seo描述"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">备注</div>
                        <div class="col-sm-10">
                            <textarea name="remark" v-model="news.remark" class="form-control" placeholder="备注"></textarea>
                         </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">发布时间</div>
                        <div class="col-sm-10">
                            <input type="date" class="form-control" id="publishDate" name="publishDate" v-model="news.publishDate" placeholder="发布时间">
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">排序号</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="news.sortno" placeholder="排序号"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">是否推荐</div>
                        <div class="col-sm-10">
                            <input class="form-check-input" type="checkbox" name="isrecommend" id="isrecommend" value="1" v-model="news.isrecommend">
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">是否启用</div>
                        <div class="col-sm-10">
                            <input class="form-check-input" type="checkbox" name="isavailable" id="isavailable" value="1" v-model="news.isavailable">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label">内容</div>
                        <div class="col-sm-10">
                            <!-- 加载编辑器的容器 -->
                            <textarea id="content" name="content" v-model="news.content" style="width:100%;height:500px;">{{news.content}}</textarea>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label"></div>
                        <input type="button" class="btn btn-primary" id="btnSaveOrUpdate" data-loading-text="保存中..." @click="saveOrUpdate" value="确定"/>
                        &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
                    </div>
        </form>
    </div>
</div>

<script src="${request.contextPath}/statics/js/modules/news/news.js?_${.now?long}"></script>
</body>
</html>